//
//  LXWithdrawSuccessController.m
//  LvXi_newVersion
//
//  Created by 王敏 on 16/9/7.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LXWithdrawSuccessController.h"
@interface LXWithdrawSuccessController(){
    UIView * _containerView;
}
@end
@implementation LXWithdrawSuccessController

-(void)viewDidLoad{
    [super viewDidLoad];
    self.view.backgroundColor = HexColor(@"#EEEEEE");
    [self setUpView];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setUpNavi];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}

-(void)didReceiveMemoryWarning{
    
}
-(void)setUpNavi{
    [super setUpNavi];
    self.navigationItem.title = @"佣金提现";
}

-(void)setUpView{
    UIImageView * imgv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"coin"]];
    imgv.size = imgv.image.size;
    imgv.centerX = self.view.width * 0.5;
    imgv.y = 64+Withdraw_height(15);
    [self.view addSubview:imgv];
    
    UILabel * l = [[UILabel alloc] initWithFrame:CGRectZero];
    l.text = @"提现申请已提交";
    l.textColor = HexColor(@"#333333");
    l.font = [UIFont systemFontOfSize:15];
    l.size = [l.text sizeInAre:MaxSize font:l.font];
    l.centerX = imgv.centerX;
    l.y = imgv.botton + Withdraw_height(15);
    [self.view addSubview:l];
    
    
    _containerView = [[UIView alloc] initWithFrame:CGRectMake(globalMargin, l.botton+Withdraw_height(15), self.view.width-2*globalMargin, Withdraw_height(90))];
    _containerView.backgroundColor = [UIColor whiteColor];
    [_containerView addRadius:10];
    [self.view addSubview:_containerView];
    
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(globalMargin, _containerView.height*0.5, _containerView.width-2*globalMargin, 0.5)];
    line.backgroundColor = HexColor(@"#EEEEEE");
    [_containerView addSubview:line];
    
    #pragma mark - 提现方式
    ///提现方式
    UILabel * l1 = [UILabel labelWithTextColor:HexColor(@"#333333") font:[UIFont systemFontOfSize:15]];
    [_containerView addSubview:l1];
    
    #pragma mark - “提现金额”
    ///“提现金额”
    UILabel * l2 = [UILabel labelWithTextColor:HexColor(@"#333333") font:[UIFont systemFontOfSize:15]];
    [_containerView addSubview:l2];
    
    #pragma mark - 提现账号
    ///提现账号
    UILabel * l3 = [UILabel labelWithTextColor:HexColor(@"#333333") font:[UIFont systemFontOfSize:13]];
    [_containerView addSubview:l3];
    
    #pragma mark - 提现金额
    ///提现金额
    UILabel * l4 = [UILabel labelWithTextColor:HexColor(@"#333333") font:[UIFont systemFontOfSize:13]];
    [_containerView addSubview:l4];
    
    l1.text = self.withdrawMethon;
    l2.text = @"提现金额";
    l3.text = self.withdrawAccount;
    l4.text = [NSString stringWithFormat:@"¥ %@",self.withdrawAmount];
    l1.size = [l1.text sizeInAre:MaxSize font:l1.font];
    l2.size = [l2.text sizeInAre:MaxSize font:l2.font];
    l3.size = [l3.text sizeInAre:MaxSize font:l3.font];
    l4.size = [l4.text sizeInAre:MaxSize font:l4.font];
    
    l1.x = globalMargin;
    l1.y = globalMargin;
    
    l2.x = globalMargin;
    l2.y = line.y+globalMargin;

    
    l3.x = _containerView.width - l3.width - globalMargin;
    l3.centerY = l1.centerY;

    
    l4.x = _containerView.width - l4.width - globalMargin;
    l4.centerY = l2.centerY;
    
    if([self.withdrawMethon isEqualToString:@"储蓄卡"]){
        UILabel * l5 = [UILabel labelWithTextColor:HexColor(@"#333333") font:[UIFont systemFontOfSize:13]];
        [_containerView addSubview:l5];
        l5.text = @"工商银行";
        l5.size = [l5.text sizeInAre:MaxSize font:l5.font];
        l5.x = l3.left - l5.width - globalMargin;
        l5.centerY = l1.centerY;
    }
    
    UIButton * okButton = [[UIButton alloc] initWithFrame:CGRectMake(globalMargin, 0, ScreenWidth-2*globalMargin, 38)];
    [okButton setTitle:@"提现" forState:UIControlStateNormal];
    [okButton setBackgroundColor:HexColor(@"#3CB034")];
    [okButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    okButton.titleLabel.font = [UIFont systemFontOfSize:14];
    
    okButton.y = _containerView.botton + Withdraw_height(15);
    [okButton addRadius:5];
    [okButton addTarget:self action:@selector(okButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:okButton];


}
-(void)okButtonClick:(UIButton*)button{
    [self backButtonClick:button];
}

@end
